import uvicorn
from fastapi import FastAPI
import asyncio #异步库

app = FastAPI()

@app.get("/")
async def read_root():
    # 模拟异步阻塞操作（如异步数据库查询）
    await asyncio.sleep(1)  # 阻塞1秒
    return {"message": "异步操作完成"}
    # return {"Hello": "中国"}

if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port=8000)
